Skip to content

Conversation

kazutakahirata
Copy link
Contributor

No description provided.

@llvmbot llvmbot added the clang Clang issues not falling into any other category label Sep 20, 2024
@llvmbot
Copy link
Member

llvmbot commented Sep 20, 2024

@llvm/pr-subscribers-clang

Author: Kazu Hirata (kazutakahirata)

Changes

Full diff: https://github.com/llvm/llvm-project/pull/109441.diff

1 Files Affected:

  • (modified) clang/utils/TableGen/ClangOpenCLBuiltinEmitter.cpp (+3-2)
diff --git a/clang/utils/TableGen/ClangOpenCLBuiltinEmitter.cpp b/clang/utils/TableGen/ClangOpenCLBuiltinEmitter.cpp
index 25c7bf0306a891..2a369271cfc3f2 100644
--- a/clang/utils/TableGen/ClangOpenCLBuiltinEmitter.cpp
+++ b/clang/utils/TableGen/ClangOpenCLBuiltinEmitter.cpp
@@ -22,6 +22,7 @@
 #include "llvm/ADT/StringExtras.h"
 #include "llvm/ADT/StringMap.h"
 #include "llvm/ADT/StringRef.h"
+#include "llvm/ADT/StringSet.h"
 #include "llvm/ADT/StringSwitch.h"
 #include "llvm/Support/ErrorHandling.h"
 #include "llvm/Support/raw_ostream.h"
@@ -889,14 +890,14 @@ static void OCL2Qual(Sema &S, const OpenCLTypeStruct &Ty,
   // Only insert the plain scalar type; vector information and type qualifiers
   // are added in step 2.
   ArrayRef<const Record *> Types = Records.getAllDerivedDefinitions("Type");
-  StringMap<bool> TypesSeen;
+  StringSet<> TypesSeen;
 
   for (const auto *T : Types) {
     // Check this is not an image type
     if (ImageTypesMap.contains(T->getValueAsString("Name")))
       continue;
     // Check we have not seen this Type
-    if (!TypesSeen.try_emplace(T->getValueAsString("Name"), true).second)
+    if (!TypesSeen.insert(T->getValueAsString("Name")).second)
       continue;
 
     // Check the Type does not have an "abstract" QualType

Copy link
Contributor

@nikic nikic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@kazutakahirata kazutakahirata merged commit d64fc57 into llvm:main Sep 20, 2024
10 checks passed
@kazutakahirata kazutakahirata deleted the cleanup_001_TypesSeen_anReuseSignature branch September 20, 2024 20:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang Clang issues not falling into any other category
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants